﻿@model IEnumerable<HanGu.Entity.Message>
@{
    Layout = null;
    int i = 1;
    ViewBag.ViewTitle = "信息";
    var SearchParma = ViewData["SearchParma"] as HanGu.Entity.UniversallySearchParam;
    var members = ViewData["members"] as SelectList;
}
<form id="pagerForm" method="get" action="/admin/@ViewData["CurrentController"]/index">
<input type="hidden" name="pageNum" value="1" />
<input type="hidden" name="numPerPage" value="@ViewData["pageSize"]" />
<input type="hidden" name="RowCount" value="@ViewData["RowCount"]" />
<input type="hidden" name="orderField" value="${param.orderField}" />
<input type="hidden" name="Ttile" value="@SearchParma.Ttile" />
<input type="hidden" name="IntObj2" value="@SearchParma.IntObj2" />
<input type="hidden" name="IntObj1" value="@SearchParma.IntObj1" />
<input type="hidden" name="StarTime" value="@SearchParma.StarDateTime" />
<input type="hidden" name="EndTime" value="@SearchParma.EndDateTime" />
<script>
    $(function () { 
    $("#Form_@ViewData["CurrentController"] #IntObj1").val("@SearchParma.IntObj1");
    $("#Form_@ViewData["CurrentController"] #IntObj2").val("@SearchParma.IntObj2");
    });
</script>
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" id="Form_@ViewData["CurrentController"]" action="/admin/@ViewData["CurrentController"]/index"
    method="post">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    类型：
                </td>
                <td>
                    <select name="IntObj1" id="IntObj1">
                        <option value="-1">--请选择--</option>
                        <option value="1">邮件</option>
                        <option value="0">短信</option>
                    </select>
                </td>
                <td>
                    会员：
                </td>
                <td>
                    @Html.DropDownList("IntObj2", members, new { @class = "combox" })
                </td>
                <td>
                    标题：
                </td>
                <td>
                    @Html.TextBox("Title", SearchParma.Ttile)
                </td>
                <td style="width:100px;">
                    更新时间:
                </td>
                <td style="width:120px;">
                    <p style="width:110px;">
                        @Html.TextBox("StarTime", SearchParma.StarDateTime, new { @class = "date", format = "yyyy-MM-dd HH:mm", @readonly = "true" })
                    </p>
                </td>
                <td>
                    ~
                </td>
                <td style="width:110px;">
                    <p style="width:110px;">
                        @Html.TextBox("EndTime", SearchParma.EndDateTime, new { @class = "date", format = "yyyy-MM-dd HH:mm", @readonly = "true" })
                    </p>
                </td>
                <td align="right">
                    <div class="subBar">
                        <ul>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="submit" name="submit">
                                            检索</button></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="admin/Message/SMS/0" target="navTab" title="群发短信">
                <span>群发短信</span></a></li>
            <li><a class="add" href="admin/Message/Email/0" target="navTab" title="群发短信">
                <span>群发邮件</span></a></li>
            <li><a class="edit" href="admin/@ViewData["CurrentController"]/{@ViewData["CurrentController"]_id}?action=view" target="navTab" warn="请选择一个用户" title="查看-@ViewBag.ViewTitle">
                <span>查看</span></a></li>
            <li><a class="delete" href="admin/@ViewData["CurrentController"]/Delete/{@ViewData["CurrentController"]_id}" target="ajaxTodo" title="确定要删除吗？" warn="请选择一条信息">
                <span>删除</span></a></li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="170">
        <thead>
            <tr class="header">
                <th style="width: 50px">
                    序号
                </th>
                <th>
                    类型
                </th>
                <th>
                    标题
                </th>
                <th>
                    会员账号
                </th>
                <th>
                    接收号码
                </th>
                <th>
                    发送人
                </th>
                <th>
                    发送时间
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            var action = "email";
            action = item.Type == 0 ? "SMS" : "Email";
                      
            <tr target="@ViewData["CurrentController"]_id" rel="@item.ID/@item.GUID" >
                <td>
                    @i
                </td>
                <td>
                    @if (item.Type == 0)
                    { 
                        <span >短信</span>
                    }
                    else
                    { 
                        <span >邮件</span>
                    }
                </td>
                <td>
                    @item.Title
                </td>
                <td>
                    
                    @{
                    var member = members.FirstOrDefault(c => c.Value == item.MemberID.ToString());
                    if (member != null)
                    { 
                        @member.Text
                    }
                    }
                </td>
                <td>
                    @item.Receiver
                </td>
                <td>
                    @item.Creator
                </td>
                <td>
                    <span formatdate="yyyy-MM-dd HH:mm">
                        @item.CreateTime</span>
                </td>
            </tr>
                    i += 1;
        }
    </table>
</div>
<div class="panelBar">
    <div class="pages">
        <span>共【@ViewData["RowCount"] 】条,每页显示【@ViewData["pageSize"] 】条</span>
    </div>
    <div class="pagination" targettype="navTab" totalcount="@ViewData["RowCount"] "
            numperpage="@ViewData["pageSize"] " pagenumshown="10" currentpage="@Request["pageNum"] ">
    </div>
</div>
